<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <title>Title</title>
    <style>
        body{
            background-image: url("../usermanagement_page/wallpaper.jpg");
            background-size: cover;
            background-attachment: fixed;
            font-family: Arial, Helvetica, sans-serif;
            background-color: #f2f2f2;
            display: flex;
            flex-direction :column;
            justify-content: center;
            align-items: center;
        }
        input[type="text"] {
            padding: 10px;
            border: none;
            border-radius: 5px;
            margin: 10px 0;
            width: 250px;
            font-size: 18px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
        }

        input[type="button"] {
            background-color: #008CBA; /* 按钮背景颜色 */
            border: none;
            color: white;
            padding: 15px 32px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 10px 0;
            border-radius: 5px;
            cursor: pointer;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
            transition-duration: 0.3s;
        }

        /* 鼠标悬停在按钮上 */
        input[type="button"]:hover {
            background-color: #005f6b; /* 按钮悬停颜色 */
        }
        #selectName {
            border: 2px solid #ccc;
            border-radius: 5px;
            padding: 5px 10px;
            font-size: 16px;
            background-color: #fff;
            color: #333;
        }

        #selectName:hover {
            border-color: #888;
        }

        #selectName option {
            font-size: 16px;
            color: #333;
        }
    </style>

</head>
<body>
<h1>删除页面</h1>
请下拉选择删除场馆
    <select name="name" id="selectName">
        <option>--请选择--</option>
    </select>



<%--<form action="/glh/register" method="get">--%>
<%--场馆名: <input id="input1" type="text" name="username"/><br>--%>

<input type="button" id="btn01" value="删除">

<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.0.js"></script>

<script>
    $(document).ready(function() {
        console.log("进来了**********")
        $.get("http://localhost:8080/stadium/admin/getStadiumNames", function(data) {
            // 将获取到的数据渲染到下拉框中
            var select = document.getElementById("selectName");
            for (var i = 0; i < data.length; i++) {
                var option = document.createElement("option");
                option.text = data[i];
                option.value = data[i];
                select.add(option);
            }
        });
    });
</script>

<script>

    $(function(){
        $("#btn01").click(function(){
            var nm=$("#selectName").val();

            var user={"stadiumName":nm};
            $.ajax({
                type:"post",
                url:"http://localhost:8080/stadium/admin/deleteByStadiumName",
                data:JSON.stringify(user),
                dataType:"json",
                success:function(data) {
                    if(data != 0){
                        window.alert("删除成功")
                        location.reload(true);
                    }
                    else{
                        window.alert("删除失败")
                    }
                }
            })
        })
    })
</script>
<body>


